package com.appspot.modutajataja;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.OnDoubleTapListener;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Toast;

public class EventActivity extends Activity implements OnGestureListener,
		OnDoubleTapListener {
	private GestureDetector detector;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_event);

		detector = new GestureDetector(this, this);

		WebView webViewInfo = (WebView) findViewById(R.id.webView_info);
		webViewInfo.getSettings().setJavaScriptEnabled(true);
		webViewInfo.loadUrl("file:///android_asset/newsticker/newsticker.html");

		WebView webViewEvent = (WebView) findViewById(R.id.webView_event);
		webViewEvent.getSettings().setJavaScriptEnabled(true);

		WebSettings set = webViewEvent.getSettings();
		set.setLoadWithOverviewMode(true);
		set.setUseWideViewPort(true);
		webViewEvent.setInitialScale(80);
		webViewEvent.setVerticalScrollBarEnabled(false);
		webViewEvent.setHorizontalScrollBarEnabled(false);

		webViewEvent.loadUrl("file:///android_asset/circular/event.html");
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		this.detector.onTouchEvent(event);
		return super.onTouchEvent(event);
	}

	@Override
	public boolean onDoubleTap(MotionEvent e) {
		Toast.makeText(this, "click1!!!", Toast.LENGTH_SHORT).show();
		Log.d("---onDoubleTap---", e.toString());
		return false;
	}

	@Override
	public boolean onDoubleTapEvent(MotionEvent e) {
		Toast.makeText(this, "click2!!!", Toast.LENGTH_SHORT).show();
		Log.d("---onDoubleTapEvent---", e.toString());
		return false;
	}

	@Override
	public boolean onSingleTapConfirmed(MotionEvent e) {
		Toast.makeText(this, "click3!!!", Toast.LENGTH_SHORT).show();
		Log.d("---onSingleTapConfirmed---", e.toString());
		return false;
	}

	@Override
	public boolean onDown(MotionEvent e) {
		return false;
	}

	@Override
	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
			float velocityY) {
		return false;
	}

	@Override
	public void onLongPress(MotionEvent e) {
	}

	@Override
	public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
			float distanceY) {
		return false;
	}

	@Override
	public void onShowPress(MotionEvent e) {
	}

	@Override
	public boolean onSingleTapUp(MotionEvent e) {
		return false;
	}
};